define(function () {

    let self;

    app.newModule({

        init: function () {
            self = this;
            self.mData = {
                orderSet: {}
            };
            self.searchData = {
                keyword: ''
            };
            self._super({
                _tag: 'p_azpj', // key, 对象放进pageModule
                _sliderId: 'slider', // tabs
                _refreshAutoInit: true //自动加载刷新控件
            }, win);

        },
        _initRefresh: function () { // 实例化刷新组件
            if (self._refreshIds.length == 0) {
                self._refreshIds = ['scrollN', 'scrollY'];
            }
            this._super(win);
        },
        _refreshCb: function (goods) {// 刷新组件回调函授
            var _super = this._super;
            app.ajax({
                xurl: "api/wx/gwat820/getGwcvDatas",
                xdata: {
                    page: goods.page + 1,
                    limit: goods.limit,
                    GWAA003: app.cookie('_WX_ACCOUNT_'),//获取微信号
                    status: goods.type.replace('scroll', ''),//注意页面上 不是1 2 3 是 Y N
                    keyword: self.searchData.keyword,//输入的查询条件 ：产品编号、意向客户姓名
                },
                cb: function (result) {
                    if (result.ok) {
                        var data = result.data;
                        goods.data.pushArray(data.data.addMap({
                            checked: false
                        }), goods.page == 0);

                        _super({
                            obj: goods,
                            dataLen: data.data.length,
                            nodata: self._refreshIndex == 0 ? '无未评价询单...' : (self._refreshIndex == 1 ? '无已评价询单...' : '无询单...')
                        });
                    }
                }
            });

        },
        _search:function(d){
            self.searchData.keyword = d.keyword.trim();
            self._refresh();
        },
        _ready: function () {
            
            Vue.component('azpj-listitem', {
                template: app.getByid(doc, 'item-template'),
                props: {
                    model: Array
                },
                methods: {
                    showDetail: function (item) { //跳转到进度查询页面
                        app.openPage({
                            src: "azpj/azpj-info.html",
                            argsKey: 'azpjinfo_page',
                            args: item
                        });
                    }
                }
            });

        },
        _lazy: function () {
            this._super();

            var search = new Vue({ //查询
                el: doc.getElementById('search'),
                data: {
                    keyword: ''
                },
                methods: {
                    toSearch: function () {
                        self.searchData.keyword = search.keyword;
                        self._refresh();
                    }
                }
            });
        }
    });

});